//package dr.server.controller.demo;
//
//import com.alibaba.fastjson.JSONObject;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.jfinal.plugin.activerecord.Db;
//import com.jfinal.plugin.activerecord.Record;
//import dr.common.ResultModel;
//import dr.modal.entity.DrMember;
//import dr.modal.service.impl.DrMemberServiceImpl;
//import dr.server.controller.base.DrBaseController;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.data.mongodb.core.query.Criteria;
//import org.springframework.data.mongodb.core.query.Query;
//import org.springframework.data.redis.core.StringRedisTemplate;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletResponse;
//import java.util.List;
//import java.util.Map;
//import java.util.concurrent.ConcurrentHashMap;
//
///**
// * @author 450216797@qq.com
// */
//@RestController
//@RequestMapping("demo")
//public class DemoController extends DrBaseController {
//
//    @Autowired
//    StringRedisTemplate stringRedisTemplate;
//
//    @Autowired
//    MongoTemplate mongoTemplate;
//
//    @Autowired
//    DrMemberServiceImpl drMemberService;
//
//    @RequestMapping("mybatis/index")
//    public ResultModel mybatisIndex(HttpServletResponse response) {
//        Map<String, Object> map = new ConcurrentHashMap<>();
//        //Wrapper方式不建议使用, 建议采用Db.find方式或者Mybatis的@Select及XML方式
//        QueryWrapper<DrMember> lambdaQueryWrapper = new QueryWrapper<>();
//        DrMember drMember = drMemberService.getOne(lambdaQueryWrapper.eq("id", 184));
//        map.put("member", drMember);
//
//        //@Select
//        List<DrMember> xmlDrMember = drMemberService.getXmlDrMember();
//        map.put("xmlDrMember", xmlDrMember);
//
//        //XML
//        List<DrMember> selectDrMember = drMemberService.getSelectDrMember();
//        map.put("selectDrMember", selectDrMember);
//
//        return ResultModel.success(map);
//    }
//
//    @RequestMapping("mysql/index")
//    public ResultModel mysqlIndex(HttpServletResponse response) {
//        List<Record> records = Db.find("select * from dr_member limit 0,5");
//        return ResultModel.success(records);
//    }
//
//    @RequestMapping("redis/index")
//    public ResultModel redisIndex() {
//        String kdNameAndCode = stringRedisTemplate.opsForValue().get("kdNameAndCode");
//        return ResultModel.success(JSONObject.parseArray(kdNameAndCode));
//    }
//
//    @RequestMapping("/mongo/index")
//    public ResultModel mongoIndex() {
//        Query query = new Query(Criteria.where("roleid").is("12"));
//        Map roleMap = mongoTemplate.findOne(query,Map.class,"dr_role_permission");
//        return ResultModel.success("",roleMap);
//    }
//}
